package com.orange.core.pojo.entity.receipt;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.orange.core.pojo.entity.IIntIdModel;
import com.orange.core.pojo.entity.IOperatorModel;
import com.orange.core.pojo.enums.EAudit;
import com.orange.core.util.Constants;
import lombok.Data;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Data
@Accessors(chain = true)
public class Receipt implements IIntIdModel<Receipt>, IOperatorModel<Receipt> {

    @TableId(type = IdType.AUTO)
    private Integer id;

    private Integer userId;

    /**
     * 店铺id
     */
    private Integer shopId;

    /**
     * 店铺名称
     */
    @TableField(exist = false)
    private String shopName;

    /**
     * 昵称
     */
    @TableField(exist = false)
    private String nickname;

    /**
     * 头像
     */
    @TableField(exist = false)
    private String avatar;

    /**
     * 消费金额
     */
    private BigDecimal amount;

    /**
     * 审核状态
     *
     * @see EAudit
     */
    private Integer auditStatus;

    /**
     * 审核失败原因
     */
    private String reason;

    /**
     * 预计积分
     */
    private Integer evaluateCredit;

    /**
     * 积分比例
     */
    private Float creditRatio;

    /**
     * 积分
     */
    private Integer credit;

    /**
     * 审核时间
     */
    @JsonFormat(pattern = Constants.DEFAULT_DATE_TIME_FORMAT)
    private LocalDateTime auditTime;

    /**
     * 审核人
     */
    private Integer auditId;

    @JsonFormat(pattern = Constants.DEFAULT_DATE_FORMAT)
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT)
    private Integer createBy;

    private LocalDateTime updateTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateBy;

    @TableField(exist = false)
    private List<ReceiptPic> pics;
}
